import { i18n } from '@app-nextmesh/common/utils';
import { RJSFSchema } from '@rjsf/utils';

export const NameSchema: {
  [key: string]: RJSFSchema;
} = {
  Name: {
    type: 'string',
    title: i18n.t('name'),
  },
};

/**
 * 至少选一个
 */
export const SelectedEntitiesSchema: {
  [key: string]: RJSFSchema;
} = {
  SelectedEntities: {
    type: 'array',
    items: {
      type: 'string',
    },
    default: [],
    minItems: 1,
  },
};

/**
 * 必须一个
 */
export const SelectedEntitiesSchema2: {
  [key: string]: RJSFSchema;
} = {
  SelectedEntities: {
    type: 'array',
    items: {
      type: 'string',
    },
    default: [],
    minItems: 1,
    maxItems: 1,
  },
};

/**
 * 可以为空
 */
export const SelectedEntitiesSchema3: {
  [key: string]: RJSFSchema;
} = {
  SelectedEntities: {
    type: 'array',
    items: {
      type: 'string',
    },
    default: [],
  },
};

export const SizeSchema: {
  [key: string]: RJSFSchema;
} = {
  MaxSize: {
    type: 'number',
    title: i18n.t('MaxSize'),
    minimum: 1e-10,
    default: 10, // TODO 最大最小尺寸应该根据模型大小来动态设置默认值
  },
  MinSize: {
    type: 'number',
    title: i18n.t('MinSize'),
    minimum: 1e-10,
    default: 1,
  },
  GrowthRate: {
    type: 'number',
    title: i18n.t('GrowthRate'),
    minimum: 1,
    default: 1,
  },
  CurvatureFactor: {
    type: 'number',
    title: i18n.t('CurvatureFactor'),
    minimum: 0,
    maximum: 1,
    default: 0,
  },
};
